<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			#div1{
				width:100px;
				height:100px;
				background: red;
			}
		</style>
	</head>
	<body>
		<script>
			window.onload = function(){
				var btn = document.getElementsByTagName('input')[0];
				var oDiv = document.getElementById("div1");
//setTimeout(回调函数,时间); 定时炸弹到时间之后执行,回调函数
				var timer = setTimeout(function(){
					oDiv.style.background = 'blue';
				},2000);
				btn.onclick = function(){
					clearTimeout(timer);
				}
			}
//			setTimeout(回调函数,时间); 定时炸弹到时间之后执行,回调函数
			
		</script>
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		<input type="button" value="拆弹" />
		
		<div id="div1"></div>
	</body>
</html>
